package com.linjiang.design.facade;

//门面模式
//为子系统中的一组接口提供一个一致的接口，模式定义了一个高层接口，这个接口使得这一子系统更加容易使用
public class FacadeTest {

    public static void main(String[] args) {
        Client client = new Client();
        client.doSomething();
    }
}

//客户端
class Client{
    Facade facade = new Facade();
    public void doSomething(){
        facade.doSomething();
    }
}

class Facade {
    SubSystem1 subSystem1 = new SubSystem1();
    SubSystem2 subSystem2 = new SubSystem2();
    SubSystem3 subSystem3 = new SubSystem3();

    public void doSomething(){
        subSystem1.method1();
        subSystem2.method2();
        subSystem3.method3();
    }
}

class SubSystem1{
    public void method1(){
        System.out.println("SubSystem1------");
    }
}

class SubSystem2{
    public void method2(){
        System.out.println("SubSystem2------");
    }
}

class SubSystem3{
    public void method3(){
        System.out.println("SubSystem3------");
    }
}
